<extend name="Public:base"/>

<block name="main">

<div id="yzh-content" class="col-xs-12">
    <div class="main-title">
        <h2>添加角色</h2>
    </div>

    <form id="myform" action="{:U('AdminRole/insert')}" method="post">
        <table class="table">
            <tr>
                <td width="120">角色名称</td>
                <td><input type="text" name="name" class="inputbox" class="input-text" /></td>
            </tr>
            <tr>
                <td>是否激活</td>
                <td>
                {:L('yes')}<input type="radio" name="status" value="1" <eq name="vo['status']" value="1">checked="checked"</eq> />
                {:L('no')}<input type="radio" name="status" value="0" <eq name="vo['status']" value="0">checked="checked"</eq> />
                </td>
            </tr>
            <tr>
                <td>{:L('remark')}</td>
                <td>
                <textarea rows="5" cols="30" name="remark">{$vo['remark']}</textarea>
                </td>
            </tr>

        </table>

        <div class="form-actions">
            <input type="submit" value="{:L('dosubmit')}" class="btn btn-sm btn-primary">
            <input type="reset" value="{:L('cancel')}" class="btn btn-sm btn-primary">
        </div>
    </form>
</div>

<script type="text/javascript">

function checknode(obj) {
    var chk = $("input[type='checkbox']");
    var count = chk.length;
    var num = chk.index(obj);
    var level_top = level_bottom =  chk.eq(num).attr('level');

    for (var i=num; i>=0; i--) {
        var le = chk.eq(i).attr('level');
        if(eval(le) < eval(level_top)) {
            chk.eq(i).attr("checked",true);
            var level_top = level_top-1;
        }
    }

    for (var j=num+1; j<count; j++){
        var le = chk.eq(j).attr('level');
        if(chk.eq(num).prop("checked")) {

            if(eval(le) > eval(level_bottom)) chk.eq(j).attr("checked",true);
            else if(eval(le) == eval(level_bottom)) break;
        }
        else {
            if(eval(le) > eval(level_bottom)) chk.eq(j).attr("checked",false);
            else if(eval(le) == eval(level_bottom)) break;
        }
    }
}
</script>
</block>